const Router = require("koa-router");
const { uploadFile } = require("@/middleware/upload.middleware");
const { fileController } = require("./file.controller");
const router = new Router({ prefix: "/file" });
const { ApiDescribe } = require('@/logger/api-logger.middleware');

// 上传文件
router.post("/upload", ApiDescribe('文件上传'), uploadFile.single('file'), fileController.upload);
// 文件绑定业务
router.post("/business_bind", ApiDescribe('绑定文件列表'), fileController.bindBizFile);
// 删除文件
router.delete("/delete/:file_id", ApiDescribe('删除文件'), fileController.deleteFile);
// 查询业务文件
router.get("/business_files/:bizId", ApiDescribe('业务文件查询'), fileController.queryFileByBiz);
// 文件预览
router.get("/preview/:fileName", ApiDescribe('文件预览'), fileController.previewFile);


module.exports = router;
